package org.kl.bf.entity.basic;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.kl.bf.entity.AuditableEntity;
import org.kl.bf.entity.Excel;
import org.kl.bf.utils.BasicConstants;

//JPA标识
@Entity
@Table(name = "basic_config")
public class Config extends AuditableEntity {

	private static final long serialVersionUID = -2926369871407757949L;
	@Excel(exportName = "配置编号")
	@NotBlank(message = "配置编号不能为空")
	private String configNo;
	@Excel(exportName = "配置名称")
	@NotBlank(message = "配置名称不能为空")
	private String configName;
	@Excel(exportName = "配置值")
	@NotBlank(message = "配置值不能为空")
	private String configValue;
	@NotNull
	@Excel(exportName = "是否启用", exportConvertSign = 1)
	private Integer enable = BasicConstants.NO_INT;

	public Config() {
	}

	public Config(long enable) {
		this.enable = (int) enable;
	}

	public String getConfigNo() {
		return configNo;
	}

	public void setConfigNo(String configNo) {
		this.configNo = configNo;
	}

	public String getConfigName() {
		return configName;
	}

	public void setConfigName(String configName) {
		this.configName = configName;
	}

	public String getConfigValue() {
		return configValue;
	}

	public void setConfigValue(String configValue) {
		this.configValue = configValue;
	}

	public Integer getEnable() {
		return enable;
	}

	public void setEnable(Integer enable) {
		this.enable = enable;
	}

	/**
	 * Excel导出值转换
	 * 
	 * @return
	 */
	public String enableConvert() {
		return enable == 1 ? "是" : "否";
	}
}
